package com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming;

import java.util.stream.IntStream;

/**
 * createTime：2021/8/18 11:06
 * description：CountingStream
 */
public class CountingStream {
    public static void main(String[] args) {
        System.out.println(
                IntStream.range(0, 10)
                        .parallel()
                        .mapToObj(CountingTask::new)
                        .map(CountingTask::call)
                        .reduce(0, Integer::sum)
        );
    }
}
